//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
// Module Name:
//
//     slots.h
//
// Abstract:
//
//     Vchiq public header.
//

#ifndef _VCHIQ_H
#define _VCHIQ_H

#include <winapifamily.h>

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

#if (NTDDI_VERSION >= NTDDI_WIN10_RS1)

EXTERN_C_START

#define FILE_DEVICE_VCHIQ          2835
#define VCHIQ_NAME L"VCHIQ"
#define VCHIQ_SYMBOLIC_NAME L"\\DosDevices\\" VCHIQ_NAME
#define VCHIQ_USERMODE_PATH L"\\\\.\\" VCHIQ_NAME

DEFINE_GUID(VCHIQ_INTERFACE_GUID, 
    0x19248ace, 0x237c, 0x488b, 0x93, 0x80, 0x26, 0x3b, 0x4f, 0x5e, 0x97, 0xe1);

//
// VCHIQ IOCTL definition
//
enum VchiqFunction
{
    //
    // VCHIQ related IOCTL. This would match current Linux definition
    // at vchiq_ioctl.h
    //
    VCHIQ_MIN_ID = 0,

    VCHIQ_CONNECT_ID = 0,
    VCHIQ_SHUTDOWN_ID = 1,
    VCHIQ_CREATE_SERVICE_ID = 2,
    VCHIQ_REMOVE_SERVICE_ID = 3,
    VCHIQ_QUEUE_MSG_ID = 4,
    VCHIQ_BULK_TRANSMIT_ID = 5,
    VCHIQ_BULK_RECEIVE_ID = 6,
    VCHIQ_AWAIT_COMPLETION_ID = 7,
    VCHIQ_DEQUEUE_MESSAGE_ID = 8,
    VCHIQ_GET_CLIENT_ID_ID = 9,
    VCHIQ_GET_CONFIG_ID = 10,
    VCHIQ_CLOSE_SERVICE_ID = 11,
    VCHIQ_USE_SERVICE_ID = 12,
    VCHIQ_RELEASE_SERVICE_ID = 13,
    VCHIQ_SET_SERVICE_OPTION_ID = 14,
    VCHIQ_DUMP_PHYS_MEM_ID = 15,
    VCHIQ_LIB_VERSION_ID = 16,
    VCHIQ_CLOSE_DELIVERED_ID = 17,

    VCHIQ_MAX_ID = 17
};

#define IOCTL_VCHIQ_CONNECT \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_CONNECT_ID, METHOD_BUFFERED , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_SHUTDOWN \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_SHUTDOWN_ID, METHOD_BUFFERED , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_CREATE_SERVICE \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_CREATE_SERVICE_ID, METHOD_IN_DIRECT , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_REMOVE_SERVICE \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_REMOVE_SERVICE_ID, METHOD_BUFFERED , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_QUEUE_MSG \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_QUEUE_MSG_ID, METHOD_OUT_DIRECT , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_BULK_TRANSMIT \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_BULK_TRANSMIT_ID, METHOD_IN_DIRECT , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_BULK_RECEIVE \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_BULK_RECEIVE_ID, METHOD_BUFFERED , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_AWAIT_COMPLETION \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_AWAIT_COMPLETION_ID, METHOD_IN_DIRECT , FILE_ANY_ACCESS)

#define IOCTL_DEQUEUE_MESSAGE \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_DEQUEUE_MESSAGE_ID, METHOD_IN_DIRECT , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_GET_CLIENT_ID \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_GET_CLIENT_ID_ID, METHOD_BUFFERED , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_GET_CONFIG \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_GET_CONFIG_ID, METHOD_IN_DIRECT , FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_CLOSE_SERVICE \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_CLOSE_SERVICE_ID, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_USE_SERVICE \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_USE_SERVICE_ID, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_RELEASE_SERVICE \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_RELEASE_SERVICE_ID, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_SET_SERVICE_OPTION \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_SET_SERVICE_OPTION_ID, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_DUMP_PHYS_MEM \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_DUMP_PHYS_MEM_ID, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_LIB_VERSION \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_LIB_VERSION_ID, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_VCHIQ_CLOSE_DELIVERED \
     CTL_CODE(FILE_DEVICE_VCHIQ, VCHIQ_CLOSE_DELIVERED_ID, METHOD_BUFFERED, FILE_ANY_ACCESS)


EXTERN_C_END

#endif // NTDDI_VERSION >= NTDDI_WIN10_RS1

#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

#endif //_VCHIQ_H